package nsu.grandfinal;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

// DB Create Class
public class DatabaseHelper extends SQLiteOpenHelper {
	
	public static final String	DATABASE_NAME			= "data";
	public static final String	DATABASE_TABLE		= "setting";
	private static final int		DATABASE_VERSION	= 1;
	
	public DatabaseHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}
	
	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("CREATE TABLE IF NOT EXISTS setting (_id INTEGER PRIMARY KEY AUTOINCREMENT,name TEXT, address TEXT, range INTEGER, latitude REAL, longitude REAL, mode INTEGER, day INTEGER, hour INTEGER, minute INTEGER, alarmcode INTEGER);");
	}
	
	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS notes");
		onCreate(db);
	}
	
	@Override
	public synchronized void close() {
		super.close();
	}
}
